<?php

/**
 * crpTag
 *
 * @copyright (c) 2008-2009 Daniele Conca
 * @link http://code.zikula.org/crptag Support and documentation
 * @author Daniele Conca <conca.daniele@gmail.com>
 * @license GNU/GPL - v.2.1
 * @package crpTag
 */

/**
 * crpTag Object
 */
class crpTagUI
{

	function crpTagUI()
	{

	}

	function newItemtags($tagString = null, $tagmodvars = array (), $tagNameArray = array ())
	{
		// Create output object
		$pnRender = pnRender :: getInstance('crpTag', false);

		$pnRender->assign($tagmodvars);
		$pnRender->assign('tagString', $tagString);
		$pnRender->assign('tagNameArray', $tagNameArray);

		// Return the output that has been generated by this function
		return $pnRender->fetch('hooks/crptag_admin_newtag.htm');
	}

	function modifyItemTags($tagString = null, $tagmodvars = array (), $tagNameArray = array ())
	{
		// Create output object
		$pnRender = pnRender :: getInstance('crpTag', false);

		$pnRender->assign($tagmodvars);
		$pnRender->assign('tagString', $tagString);
		$pnRender->assign('tagNameArray', $tagNameArray);

		// Return the output that has been generated by this function
		return $pnRender->fetch('hooks/crptag_admin_modifytag.htm');
	}

	function displayItemTags($tagArray = array (), $tagString = null, $tagNameArray = array (), $tagmodvars = array (), $returnurl=null, $can_edit = false)
	{
		// Create output object
		$pnRender = pnRender :: getInstance('crpTag', false);

		$pnRender->assign($tagmodvars);
		$pnRender->assign('tagArray', $tagArray);
		$pnRender->assign('tagString', $tagString);
		$pnRender->assign('tagNameArray', $tagNameArray);
		$pnRender->assign('returnurl', $returnurl);
		$pnRender->assign('can_edit', $can_edit);

		// Return the output that has been generated by this function
		return $pnRender->fetch('crptag_user_embedtag.htm');
	}

	function displayAddItemTags($id_module,$tagmodule, $tagmodvars = array (), $returnurl=null, $can_add = false)
	{
		// Create output object
		$pnRender = pnRender :: getInstance('crpTag', false);

		$pnRender->assign($tagmodvars);
		$pnRender->assign('returnurl', $returnurl);
		$pnRender->assign('can_add', $can_add);
		$pnRender->assign('id_module', $id_module);
		$pnRender->assign('tagmodule', $tagmodule);

		// Return the output that has been generated by this function
		return $pnRender->fetch('crptag_user_addtag.htm');
	}

	function displayTaggedItems($tagArray = array (), $tagmodvars = array (), $pager = array (), $id_tag = null, $tagmodule = null)
	{
		// Create output object
		$pnRender = pnRender :: getInstance('crpTag', false);

		$pnRender->assign($tagmodvars);
		$pnRender->assign('tagArray', $tagArray);
		$pnRender->assign('pager', $pager);
		$pnRender->assign('id_tag', $id_tag);
		$pnRender->assign('tagmodule', $tagmodule);

		// Return the output that has been generated by this function
		return $pnRender->fetch('crptag_user_viewtag.htm');
	}

	function displayMyTaggedItems($tagArray = array (), $tagmodvars = array (), $pager = array (), $uid)
	{
		// Create output object
		$pnRender = pnRender :: getInstance('crpTag', false);

		$pnRender->assign($tagmodvars);
		$pnRender->assign('tagArray', $tagArray);
		$pnRender->assign('pager', $pager);
		$pnRender->assign('uid', $uid);

		// Return the output that has been generated by this function
		return $pnRender->fetch('crptag_user_viewminetag.htm');
	}

	function displayMain($tagArray = array (), $tagmodvars = array (), $pager = array ())
	{
		// Create output object
		$pnRender = pnRender :: getInstance('crpTag', false);

		$pnRender->assign($tagmodvars);
		$pnRender->assign('tagArray', $tagArray);
		$pnRender->assign('pager', $pager);

		// Return the output that has been generated by this function
		return $pnRender->fetch('crptag_user_maintag.htm');
	}

	/**
	 * Draw modify configuration form
	 *
	 * @return string html
	 */
	function modifyConfig($modvars = array ())
	{
		// Create output object
		$pnRender = pnRender :: getInstance('crpTag', false);

		$pnRender->assign($modvars);

		// Return the output that has been generated by this function
		return $pnRender->fetch('crptag_admin_modifyconfig.htm');
	}
}